package com.smart.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.smart.model.customdo.UseControlCustomDO;
import com.smart.model.domain.ProjectUseControlDO;
import com.smart.model.request.OperateProjectRequest;
import com.smart.model.request.ProjectUseControlRequest;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author zhanghong
 */
@Repository
public interface ProjectUseControlMapper extends BaseMapper<ProjectUseControlDO> {
    ProjectUseControlDO selectDOById(Long id);
    List<ProjectUseControlDO> selectDOList(ProjectUseControlDO projectUseControl);
    int insertDO(ProjectUseControlDO projectUseControl);
    int batchInsertDO(List<ProjectUseControlDO> projectUseControlDOList);
    int updateDO(ProjectUseControlDO projectUseControl);
    int deleteDOById(Long id);
    int deleteDOByIds(String[] ids);

    long pageCount(@Param("param") OperateProjectRequest param);
    List<UseControlCustomDO> pageQuery(@Param("param") OperateProjectRequest param, @Param("limit") int limit, @Param("offset") long offset);

    List<UseControlCustomDO> listByCondition(@Param("param") OperateProjectRequest param);

    @Select("select * from project_use_control where project_id=#{projectId} limit 1")
    ProjectUseControlDO queryByProjectId(Long projectId);

    UseControlCustomDO queryByProjectId2(long projectId);
}
